package com.tc168.cp306.b06.fragment;


import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.maning.mndialoglibrary.MProgressDialog;
import com.tc168.cp306.b06.R;
import com.tc168.cp306.b06.activity.BangzhuActivity;
import com.tc168.cp306.b06.activity.BangzhufiveActivity;
import com.tc168.cp306.b06.activity.BangzhufourActivity;
import com.tc168.cp306.b06.activity.BangzhusixActivity;
import com.tc168.cp306.b06.activity.BangzhuthreeActivity;
import com.tc168.cp306.b06.activity.BangzhutwoActivity;


/**
 * A simple {@link Fragment} subclass.
 */
public class BangzhuFragment extends Fragment implements View.OnClickListener {


    public BangzhuFragment() {
        // Required empty public constructor
    }

    private Button one, two, three, four, five, six;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_bangzhu, container, false);


    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);


        MProgressDialog.showProgress(getActivity());


        new Handler().postDelayed(new Runnable() {

            @Override

            public void run() {
                MProgressDialog.dismissProgress();
            }
        }, 1000);
        one = view.findViewById(R.id.bangzhuone);
        two = view.findViewById(R.id.bangzhutwo);
        three = view.findViewById(R.id.bangzhuthree);
        four = view.findViewById(R.id.bangzhufour);
        five = view.findViewById(R.id.bangzhufive);
        six = view.findViewById(R.id.bangzhusix);


        one.setOnClickListener(this);
        two.setOnClickListener(this);
        three.setOnClickListener(this);
        four.setOnClickListener(this);
        five.setOnClickListener(this);
        six.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.bangzhuone:
                startActivity(new Intent(getActivity(), BangzhuActivity.class));
                break;
            case R.id.bangzhutwo:
                startActivity(new Intent(getActivity(), BangzhutwoActivity.class));

                break;
            case R.id.bangzhuthree:
                startActivity(new Intent(getActivity(), BangzhuthreeActivity.class));

                break;
            case R.id.bangzhufour:
                startActivity(new Intent(getActivity(), BangzhufourActivity.class));

                break;
            case R.id.bangzhufive:
                startActivity(new Intent(getActivity(), BangzhufiveActivity.class));

                break;
            case R.id.bangzhusix:
                startActivity(new Intent(getActivity(), BangzhusixActivity.class));

                break;


        }
    }
}
